<?php

session_start();

$_SESSION['log'] = 0;

include_once("connexion.php");

if(isset($_POST["OK"])) {

	$pseudo = $_POST["pseudo"];
	$password = $_POST["password"];

	$query=("SELECT id,nom,prenom,password FROM utilisateurs WHERE pseudo='$pseudo';");
	$log = mysqli_fetch_array(mysqli_query ($bdd,$query));


	if ($log['password'] != $password)
	{
		echo "Mot de passe ou Login incorecte";
	}
	else
	{
		$_SESSION['log'] = 1;
		$_SESSION['id_user'] = $log['id'];
		$_SESSION['nom'] = $log['nom'];
		$_SESSION['prenom'] = $log['prenom'];
		$_SESSION['pseudo'] = $pseudo;
		header('Location:accueil.php');
	}
}
include_once("index.html");
?>

